package cn.slipi.message.handler;

import org.springframework.amqp.core.AmqpTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;

@Component
public class MessageHandler {

    @Value(value = "${mq.message.exchange}")
    private String exchange;

    @Autowired
    private AmqpTemplate amqpTemplate;

    /**
     * 发送消息
     *
     * @param routingKey
     * @param content
     */
    public void send(String routingKey, String content) {
        this.amqpTemplate.convertAndSend(this.exchange, routingKey, content);
    }

}
